<template>
    <div class="block">
      <div class="radio">
        排序：
        <el-radio-group v-model="reverse">
          <el-radio :label="true">倒序</el-radio>
          <el-radio :label="false">正序</el-radio>
        </el-radio-group>
        <br />
        <br />
        <br />
      </div>
  
      <el-timeline :reverse="reverse" class="timeline">
        <el-timeline-item
          v-for="(activity, index) in activities"
          :key="index"
          :timestamp="activity.timestamp"
          :class="{ 'active-activity': activity.status === 'ongoing' }"
        >
          {{ activity.content }}
          <i class="el-icon-circle-check" v-if="activity.status === 'ongoing'"></i>
        </el-timeline-item>
      </el-timeline>
    </div>
  </template>
  
  <script>
  
  export default {
    data() {
      return {
        reverse: true,
        activities: [
          {
            content: '未上课',
            timestamp: '2023-11-19 12:30',
            status: 'notStarted', // 添加状态属性
          },
          {
            content: '正在上课',
            timestamp: '2023-11-19 12:30-2:30',
            status: 'ongoing', // 添加状态属性
          },
          {
            content: '课程已结束',
            timestamp: '2023-11-19 2:30',
            status: 'finished', // 添加状态属性
          },
        ],
      };
    },
  };
  </script>
  
  <style scoped>
  .block {
    margin: -1px;
    background-color: #e6f7ff; /* 正在上课状态的背景色 */
  border: 2px solid #67c23a; /* 正在上课状态的边框颜色 */
  border-radius: 5px;
  }
  
  .radio {
    margin-bottom: 0px;
  }
  
  .timeline {
    margin-top: 59px;
  }
  
  .active-activity {
    font-weight: bold;
    color: #409eff;
  }
  
  .active-activity i {
    color: #67c23a; /* 设置图标颜色 */
  }
  </style>
  